#include <bits/stdc++.h>
using namespace std;
set<int> X[200005];
set<int> Y[200005];

int main() {
  int H, W;
  cin >> H >> W;
  int N;
  cin >> N;

  for (int i = 1; i <= N; i++) {
    int x, y;
    cin >> x >> y;
    X[x].insert(y);
    Y[y].insert(x);
  }
  int Q;
  cin >> Q;
  for (int i = 1; i <= Q; i++) {
    int a, b;
    cin >> a >> b;
    if (a == 1) {
      cout << X[b].size() << " " << endl;
      for (auto y : X[b]) {
        Y[y].erase(b);
      }
      X[b].clear();
    }

    else {

      cout << Y[b].size() << " " << endl;
      for (auto x : Y[b]) {
        X[x].erase(b);
      }
      Y[b].clear();
    }
  }
  return 0;
}